package com.ewing.common.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ewing.common.constants.FrontParamConstants;
import com.ewing.core.auth.RequestHolder;
import com.ewing.utils.IntegerUtils;

public class BasePraramUtils {
  /**
   * 默认生成的该类的LOG记录器，使用slf4j组件。避免产生编译警告，使用protected修饰符。
   */
  protected final static Logger LOG = LoggerFactory.getLogger(BasePraramUtils.class);
  
  public static String getShopId(){
    return RequestHolder.getRequest().getParameter(FrontParamConstants.SHOP_ID);
  }
  
  public static int getShopIdInt(){
    return IntegerUtils.parseInt("" + RequestHolder.getRequest().getAttribute(FrontParamConstants.SHOP_ID));
  }
  
  public static String getClientUrl(){
    return RequestHolder.getRequest().getParameter(FrontParamConstants.CLIENT_URL);
  }
  
  public static String getCookie(){
    return RequestHolder.getRequest().getParameter(FrontParamConstants.COOKIE);
  }
  
  public static String getSessionId(){
    return RequestHolder.getRequest().getParameter(FrontParamConstants.SESSION_ID);
  }
}
